import {createStore} from 'vuex'

export default createStore({
    state: {
        collapse: false,  // 导航栏收缩状态

        userInfo: {}
    },
    getters: {
        //获取导航菜单的收缩状态
        collapse(state) {
            return state.collapse
        }
    },
    mutations: {
        //将登录的用户信息放入到vuex
        initUserInfo(state, userInfo) {
            state.userInfo = userInfo;
        },


        //改变收缩状态
        toggleCollapse(state) {
            state.collapse = !state.collapse
        },

        logout(state) {
            state.userInfo = {};
        },
    },
    actions: {},
    modules: {}
})
